package com.xuxueli.applyModules.entity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.xuxueli.applyModules.listener.ExcelValid;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@Data   //此注释需要导入lombok
@ContentRowHeight(25) //数据表格列高
@HeadRowHeight(20) //标题表格列高
@ColumnWidth(25) //标题表格列宽
public class GraduaterNamePara {

    @ExcelValid(message = "学号不能为空")
    @ExcelProperty(value = "学号")  //index表示读取的数据在第几列，根据业务需求自行对应
    @NotNull(message = "学号不能为空")
    private String xh;

    @ExcelProperty(value = "姓名")
    private String xm;

    @ExcelProperty(value = "学院名称")
    private String xymc;

    @ExcelProperty(value = "类型")
    private String type;

    @ExcelProperty(value = "描述")
    private String description;

    @ExcelProperty(value = "学生类别")
    private String xslb;

    @ExcelIgnore
    private Integer rowNum;

    @ExcelProperty(value = "错误信息")
    @ExcelIgnore
    private String message;

    /**
     * 日期类型转换
     */
    @DateTimeFormat("yyyy/MM/dd")
    @ExcelProperty(value ="日期")
    @ExcelIgnore
    private String day;


    /**
     * 身份证号码
     */
    @ExcelProperty(value = "身份证号码")
    @ColumnWidth(value = 20)
    @NotBlank(message="身份证号码不能为空")
    @Pattern(regexp = "^\\d{15}$|^\\d{17}[0-9Xx]$",message = "身份证格式不正确!")//长度18，0-9
    private String cardNo;

    /**
     * 联系电话
     */
    @ExcelProperty(value = "联系电话")
    @ColumnWidth(value = 20)
    @NotBlank(message="联系电话不能为空")
    @Pattern(regexp = "^[1][3,4,5,7,8][0-9]{9}$",message = "联系电话格式不正确!")//长度11
    private String telephone;

    /**
     * 银行卡号
     */
    @ExcelProperty(value = "银行卡号")
    @ColumnWidth(value = 20)
    @NotBlank(message="银行卡号不能为空")
    @Pattern(regexp = "^([1-9]{1})(\\d{14}|\\d{18})$",message = "银行卡号格式不正确!")//长度11
    private String bankCardNo;

}